package com.ruoyi.system.designpattern.wrapper;

/**
 * 家庭影院外观类
 *
 * @author created by Zhou Zongbo on 2025/9/24.
 */
public class HomeTheaterFacade {
    private final DvdPlayer dvdPlayer;
    private final Projector projector;
    private final SoundSystem soundSystem;

    public HomeTheaterFacade(DvdPlayer dvdPlayer, Projector projector, SoundSystem soundSystem) {
        this.dvdPlayer = dvdPlayer;
        this.projector = projector;
        this.soundSystem = soundSystem;
    }


    // 统一的接口：准备观影
    public void watchMovie(String movie) {
        System.out.println("\n准备开始观影...");
        projector.on();
        projector.wideScreenMode();
        soundSystem.on();
        soundSystem.setVolume(10);
        dvdPlayer.on();
        dvdPlayer.play(movie);
    }

    // 统一的接口：暂停观影
    public void pauseMovie() {
        System.out.println("\n暂停观影...");
        dvdPlayer.pause();
    }

    // 统一的接口：结束观影
    public void endMovie() {
        System.out.println("\n结束观影...");
        dvdPlayer.stop();
        dvdPlayer.off();
        soundSystem.off();
        projector.off();
    }
}
